$(function(){
					//零食跳转
				$('#produce_one_open').click(function(){
					window.open('produce_search_one.html');
				});
					//红酒跳转
				$('#produce_two_open').click(function(){
					window.open('produce_search_two.html');
				});
				$('#produce_search_three').click(function(){
					window.open('商品列表.html');
				});
				//商品栏菜单
				$('.promo_show_title').hover(
					function(){
						var ind = $(this).index();
						$('.show_sort').eq(ind).show();
						$(this).css('background-color', 'white').css('color', '#434343');
					}, 
					function(){
						var ind = $(this).index();
						$('.show_sort').eq(ind).hide();
						$(this).css('background-color', '#434343').css('color', 'white');
					});
				//正方体下的按钮触发
					//登录按钮
				$('#promo_login_rect_button').hover(
					function(){
						$(this).css('background-color', '#ff4040').css('color', '#edeef3');
					}, 
					function(){
						$(this).css('background-color', '#edeef3').css('color', '#ff4040');
					});
					//注册按钮
				$('#promo_rigis_rect_button').hover(
					function(){
						$(this).css('background-color', '#ff4040').css('color', '#edeef3');
					}, 
					function(){
						$(this).css('background-color', '#edeef3').css('color', '#ff4040');
					});
					//登录跳转
					$('#promo_login_rect_button').click(function(){
						window.open('loginHtm.html');
					});
					//注册跳转
					$('#promo_rigis_rect_button').click(function(){
						window.open('registerHtm.html');
					});
				$('.promo_login_rect_msg').hover(
					function(){
						$(this).css('color', '#ff4040');
					}, 
					function(){
						$(this).css('color', '#666666');
					});
				//设置图片的左右切换按妞的可见性
				$('#promo_img').hover(
					function(){
						$('#promo_img_right_button').css('display', 'block');
						$('#promo_img_left_button').css('display', 'block');
					},
					function(){
						$('#promo_img_right_button').css('display', 'none');
						$('#promo_img_left_button').css('display', 'none');
					});
				$('.seckill_list').hover(
					function(){
						$('#seckill_list_prod_left').css('display', 'block');
						$('#seckill_list_prod_right').css('display', 'block');
					},
					function(){
						$('#seckill_list_prod_left').css('display', 'none');
						$('#seckill_list_prod_right').css('display', 'none');
					});
				$('#seckill_list_prod_left').hover(
					function(){
						$(this).css('display', 'block');
					},
					function(){
						$(this).css('display', 'none');
					});
				$('#seckill_list_prod_right').hover(
					function(){
						$(this).css('display', 'block');
					},
					function(){
						$(this).css('display', 'none');
					});
					
			
			});
			
			//图片轮播
			var time1 = setInterval(test,2000); 
			var index = 0; 
			var imgarray = new Array("img/home_page/5a251162Nbea58875.jpg",
				"img/home_page/5a264f45N6cf3a4d7.jpg","img/home_page/5a2665f0N3e5c320b.jpg",
				"img/home_page/5a268d4dNa5c523ed.jpg","img/home_page/5a26a47aNb115dbf7.jpg",
				"img/home_page/5a26cbb0N49792154.jpg");
			var myimg=document.getElementById("promo_imgs");
			$('.promo_img_bottom_round').eq(0).addClass('promo_img_bottom_select');
			function test() { 
				$('.promo_img_bottom_round').eq(index).removeClass('promo_img_bottom_select');
				if(index==imgarray.length-1) 
				{ 
					index=0; 
				} else {
					index++; 
				}
				myimg.src=imgarray[index]; 
				$('.promo_img_bottom_round').eq(index).addClass('promo_img_bottom_select');
			};
			
			//设置图片底部按钮鼠标进入事件
			$('.promo_img_bottom_round').mouseenter(function(){
				//先清除上一个按钮的样式
				$('.promo_img_bottom_round').eq(index).removeClass('promo_img_bottom_select');
				//停止此时间器
				clearInterval(time1); 
				//获取此索引
				var imgind = $(this).index();
				index = imgind;
				myimg.src=imgarray[index];
				//设置选中的样式
				$('.promo_img_bottom_round').eq(index).addClass('promo_img_bottom_select');
			});
			
			//设置图片底部按钮鼠标退出事件
			$('.promo_img_bottom_round').mouseout(function(){
				//设置时间器
				time1 = setInterval(test,2000);
			});
			
			//设置返回上一张图片
			$('#promo_img_left_button').click(function(){
				$('.promo_img_bottom_round').eq(index).removeClass('promo_img_bottom_select');
				clearInterval(time1);
				if(index==0) 
				{ 
					index=imgarray.length; 
				}
				index = index - 1;
				myimg.src=imgarray[index];
				$('.promo_img_bottom_round').eq(index).addClass('promo_img_bottom_select');
				time1 = setInterval(test,2000);
			});
			
			//设置返回下一张图片
			$('#promo_img_right_button').click(function(){
				$('.promo_img_bottom_round').eq(index).removeClass('promo_img_bottom_select');
				clearInterval(time1);
				if(index==imgarray.length -1) 
				{ 
					index = -1; 
				}
				index = index + 1;
				myimg.src=imgarray[index];
				$('.promo_img_bottom_round').eq(index).addClass('promo_img_bottom_select');
				time1 = setInterval(test,2000);
			});
			
			//时间倒计时
			var time_hour = $('#clock_hour').html();
			var time_minute = $('#clock_minute').html();
			var time_second = $('#clock_second').html();
			function changeSecond() {
				if(time_second > 0) {
					time_second -= 1; 
					if(time_second<10){
						time_second = '0' + time_second;
					}
				} else {
					if(time_minute > 0) {
						time_minute -= 1;
						time_second = 59;
						if(time_minute<10){
							time_minute = '0' + time_minute;
						}
					} else {
						if(time_hour > 0) {
							time_minute = 59;
							time_second = 59;
							time_hour -= 1;
							if(time_hour<10){
								time_hour = '0' + time_hour;
							}
						}
					} 
				}
				$('#clock_second')[0].innerHTML = time_second;
				$('#clock_minute')[0].innerHTML = time_minute;
				$('#clock_hour')[0].innerHTML = time_hour;
			};
			setInterval(changeSecond, 1000);
			
			var scorllSetOff = 0;
			function slideProRight() {
				var $pros = $('.seckill_list');
				scrollToContainer = $pros.find('.seckill_list_prod:last');
				//动画效果
				if(scrollToContainer.offset().left > 2046 ) {
					scorllSetOff += 1023;
					$pros.animate({scrollLeft: scorllSetOff }, 1000);
				}
				else if(scrollToContainer.offset().left > 1023 && scorllSetOff < 2800){
					scorllSetOff += 765;
					$pros.animate({scrollLeft: scrollToContainer.offset().left 
						- $pros.offset().left 
						+ $pros.scrollLeft() -765}, 1000);//2秒滑动到指定位置
				}
			}
			
			function slideProLeft() {
				var $pros = $('.seckill_list');
				scrollToContainer = $pros.find('.seckill_list_prod:first');
				//动画效果  
				if(scrollToContainer.offset().left < 2046 && scorllSetOff > 0) {
					scorllSetOff -= 1023;
					$pros.animate({scrollLeft: scorllSetOff }, 1000);
					if(scorllSetOff < 0) {
						scorllSetOff = 0;
					}
				} 
				
			}
			
			document.getElementById('seckill_list_prod_left').onclick = slideProLeft;
			document.getElementById('seckill_list_prod_right').onclick = slideProRight;
			
			$('.rank_content').eq(1).addClass('none');
			$('.rank_content').eq(2).addClass('none');
			$('.rank_content').eq(3).addClass('none');
			$('.rank_content').eq(4).addClass('none');

			$('.rank_tab ul li').eq(0).addClass('rang_tab_checked');
			
			var tab_index = 0;
			$('.rank_tab ul li').mouseenter(function(){
				if(tab_index != $(this).index()) {
					$('.rank_tab ul li').eq(tab_index).removeClass('rang_tab_checked');
					$('.rank_content').eq(tab_index).addClass('none');
				}
				tab_index = $(this).index();
				$('.rank_content').eq(tab_index).removeClass('none')
				$('.rank_tab ul li').eq(tab_index).addClass('rang_tab_checked');
			});
			

